<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="embroot.css">
<TITLE>
Parameters for Initialising an ECLiPSe engine
</TITLE>
</HEAD>
<BODY >
<A HREF="embroot059.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot065.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc127">Appendix&nbsp;A</A>&nbsp;&nbsp;Parameters for Initialising an ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> engine</H1>
<BR>
<BR>
<A NAME="chapecoptions"></A>
It is possible to parametrise the initialisation of the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>engine by calling the functions ec_set_option_long() and ec_set_option_ptr().
This must be done before initialisation.
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>Installation directory</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
 ec_set_option_ptr(EC_OPTION_ECLIPSEDIR, "/usr/tom/eclipse");
</PRE>This can be used to tell an embedded ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> where to find it support files.
The default setting is NULL, which means that the location is
taken from the registry entry or from the ECLIPSEDIR environment variable.<BR>
<BR>
<DT CLASS="dt-description"><B>Stack Memory Allocation</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
 ec_set_option_long(EC_OPTION_LOCALSIZE, 128*1024*1024);
 ec_set_option_long(EC_OPTION_GLOBALSIZE, 128*1024*1024);
</PRE>The sizes in bytes of the stacks can be varied. They will be rounded to
system specific pagesizes. On machines where initially only virtual memory
is reserved rather than allocating real memory (WindowsNT/95, Solaris) they
default to very large sizes (128MB), where real memory or space in the
operating system swap file is taken immediately (SunOS), their default
is very small (750KB,250KB).<BR>
<BR>
<DT CLASS="dt-description"><B>Heap Memory Allocation</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
 ec_set_option_long(EC_OPTION_PRIVATESIZE, 32*1024*1024);
 ec_set_option_long(EC_OPTION_SHAREDSIZE, 64*1024*1024);
</PRE>The sizes in bytes of the private and shared heaps. Normally these are
ignored as the heaps grow as required.<BR>
<BR>
They are used in the parallel ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>, since there allocation is done
at fixed addresses and in that case these sizes determine the maximum
amount of memory per heap.<BR>
<BR>
<DT CLASS="dt-description"><B>Panic Function</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
        void my_panic(char * what, char * where);
 ...
 ec_set_option_ptr(EC_OPTION_PANIC, my_panic);
</PRE>When ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> experiences an unrecoverable error, this function
is called. By default a function that prints the panic message
and exits is called. After such an error, one should not call any
of the functions in this interface.<BR>
<BR>
<DT CLASS="dt-description"><B>Startup Arguments</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
        char *args[] = {"a","b","c"}
 ...
 ec_set_option_long(EC_OPTION_ARGC, 3);
 ec_set_option_ptr(EC_OPTION_ARGV, args);
</PRE>These setting are used to simulate a command line for an embedded
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>, or to pass command line information to an embedded
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>. The ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> built-in predicates (<CODE>argc/1</CODE>
and <CODE>argv/2</CODE>) can access this information. This provides
a way of passing some initial data to the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> engine.<BR>
<BR>
<DT CLASS="dt-description"><B>Default Module</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
 ec_set_option_ptr(EC_OPTION_DEFAULT_MODULE, "my_module");
</PRE>The default module is the module in which goals called from the
top-level execute. It is also the module that goals called from C
or C++ execute in. The default setting is "eclipse".<BR>
<BR>
<DT CLASS="dt-description"><B>I/O Initialisation</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
 ec_set_option_long(EC_OPTION_IO, MEMORY_IO);
</PRE>This option controls whether the default I/O streams of ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> are
connected to stdin/stdout/stderr or to memory queues.
The default setting of this option is SHARED_IO, which means the
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> streams 0,1,2 are connected to stdin/stdout/stderr.
In an embedded application, stdin/stdout/stderr may not be available,
or the host application may want to capture all I/O from ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP>.
In this case, use the MEMORY_IO setting, which creates queue streams
for streams 0,1 and 2. These can then be read and written using
ec_queue_read() and ec_queue_write().<BR>
<BR>
<DT CLASS="dt-description"><B>Parallel system parameters</B><DD CLASS="dd-description"><BR>
<PRE CLASS="verbatim">
 ec_set_option_long(EC_OPTION_PARALLEL_WORKER, 0);
 ec_set_option_long(EC_OPTION_ALLOCATION, ALLOC_PRE);
 ec_set_option_ptr(EC_OPTION_MAPFILE, NULL);
</PRE>The above options are set differently in ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> when it is a
worker in a parallel system. They should not be altered.
</DL>

<BR>
<BR>
<HR>
<A HREF="embroot059.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot065.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
